﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;


namespace OfficeOnline
{
   // public partial class MdiForm : Form
    //{
    //    private const int WM_DDE_INITIATE = 0x03E0;
    //    private const int WM_DDE_ACK = WM_DDE_INITIATE + 4;
    //    private const int WM_DDE_EXECUTE = WM_DDE_INITIATE + 8;

    //    [DllImport("user32.dll")]
    //    public static extern int SendMessage(IntPtr h, int m, IntPtr Wp, IntPtr Lp);
    //    [DllImport("user32.Dll")]
    //    public static extern bool PostMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
    //    [DllImport("kernel32.dll")]
    //    public static extern IntPtr GlobalLock(IntPtr hMem);
    //    [DllImport("kernel32.dll")]
    //    public static extern bool GlobalUnlock(IntPtr hMem);

    //    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
    //    //protected override void WndProc(ref Message m)
    //    //{
    //    //    // Listen for operating system messages.
    //    //    switch (m.Msg)
    //    //    {
    //    //        case WM_DDE_EXECUTE:
    //    //            //MessageBox.Show("WM_DDE_EXECUTE");
    //    //            IntPtr pV = GlobalLock(m.LParam);
    //    //            string docPath = System.Runtime.InteropServices.Marshal.PtrToStringAuto(pV);
    //    //            GlobalUnlock(m.LParam);

    //    //            openDocument(docPath);

    //    //            //After the message has been processed
    //    //            PostMessage(m.WParam, WM_DDE_ACK, m.HWnd, IntPtr.Zero);
    //    //            break;

    //    //        case WM_DDE_INITIATE:
    //    //            //MessageBox.Show("WM_DDE_INITIATE");
    //    //            SendMessage(m.WParam, WM_DDE_ACK, this.Handle, IntPtr.Zero);
    //    //            break;

    //    //        default:
    //    //            base.WndProc(ref m);
    //    //            break;
    //    //    }

    //    //}
    //}
}
